import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/app_bar/app_bar_widget.dart';
import 'package:yt_devops/components/app_permission/permission_widget.dart';
import 'package:yt_devops/components/app_permission/yt_my_top_bar.dart';
import 'package:yt_devops/components/app_permission/yt_tab_and_tabview.dart';
import 'package:yt_devops/components/app_permission/yt_tab_bar_view.dart';
import 'package:yt_devops/components/log_utils.dart';
import 'package:yt_devops/pages/site/site_observer_list/views/my_top_tabbar.dart';
import 'package:yt_devops/styles/styles.dart';
import 'package:yt_devops/utils/constants/permission_page_constant.dart';
import '../siet_elec_price_setting/site_mains_elec_detail/keep_aliver_wrapper.dart';
import 'main_price_setting_controller.dart';

class MainPriceSettingPage extends GetView<MainPriceSettingController> {
    const MainPriceSettingPage({Key? key}) : super(key: key);

    @override
    Widget build(BuildContext context) {

        return GetBuilder<MainPriceSettingController>(
            builder: (_) {
                Log.d('MainPriceSettingController==');
                return Scaffold(
                    appBar: AppBarWidget.withRightActions(
                        controller.title,
                        actions: [
                             Visibility(
                                visible: controller.isShowAdd,
                                child: IconButton(
                                    iconSize: 26,
                                    icon: const Icon(Icons.add),
                                    onPressed: (){
                                      controller.addNewElecPriceRule();
                                    },
                                )),

                        ],
                    ),
                    body:    YtTabAndTabview(controller.permissionGroups,(int index){
                        Log.d('index==' + index.toString());
                        controller.onItemTapped(index);
                      }),



                );
            },
        );
    }
}
